package hczc.longcai.com.hccrowdfunding.home.fourth_mine.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.beans.InvestmentOrder;

/**
 * Created by Administrator on 2016/1/27.
 */
public class InvestmentOrderAdapter extends BaseAdapter {

    private Context context;
    private List<InvestmentOrder> list;

    public InvestmentOrderAdapter(Context context, List<InvestmentOrder> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_investment_order,null);
            BaseApplication.scaleScreenHelper.loadView(((ViewGroup) convertView));
            holder.title = ((TextView) convertView.findViewById(R.id.investment_order_title));
            holder.copies = ((TextView) convertView.findViewById(R.id.investment_order_copies));
            holder.money = ((TextView) convertView.findViewById(R.id.investment_order_money));
            holder.pic = ((ImageView) convertView.findViewById(R.id.investment_order_pic));
            convertView.setTag(holder);
        }





        return convertView;
    }


    class ViewHolder{
        TextView title,copies,money;
        ImageView pic;
    }
}
